package zOthers;
import Controller.ControllerGame;
import Controller.ControllerStartMenu;
import Model.ModelFrameMain;
import Model.ModelPanelGame;
import Model.ModelPanelStartMenu;
import NetOperation.SimpleRequest;
import View.ViewFrameMain;
import View.ViewPanelGame;
import View.ViewPanelStartMenu;


public class MyStory {
	public static ImageLoader imageLoader;

	public static void main(String[] args){
		// Load images
		imageLoader = new ImageLoader();

		// Initiate Debug Log
		Log.zInit();

		// Initiate Net-operations
		SimpleRequest.zInit();

		// Initialize models
		ModelFrameMain mFrameMain = new ModelFrameMain();
		ModelPanelStartMenu mPanelLogin = new ModelPanelStartMenu();
		ModelPanelGame mPanelGame = new ModelPanelGame();

		// Initialize controllers
		ControllerStartMenu cLogin = new ControllerStartMenu();
		ControllerGame cGame = new ControllerGame();

		// Initialize views
		ViewFrameMain vFrameMain = new ViewFrameMain();
		ViewPanelStartMenu vPanelLogin = new ViewPanelStartMenu();
		ViewPanelGame vPanelGame = new ViewPanelGame();

		// Add views to controllers
		cLogin.addView(vPanelLogin);
		cLogin.addView(vFrameMain);

		cGame.addView(vPanelGame);
		cGame.addView(vFrameMain);

		// Add models to controllers
		cLogin.addModel(mPanelLogin);
		cLogin.addModel(mFrameMain);

		cGame.addModel(mPanelGame);
		cGame.addModel(mFrameMain);

		// Tell views who is the controller
		vPanelLogin.setController(cLogin);
		vPanelGame.setController(cGame);

		// Initialize
		mPanelLogin.modelInitialization();
		mPanelGame.modelInitialization();

		vFrameMain.addPanel(vPanelLogin.getPanel());
		vFrameMain.addPanel(vPanelGame.getPanel());

		mFrameMain.setModelPanelLogin(mPanelLogin);
		mFrameMain.modelInitialization();



	}
}
